先備知識
何謂演算法?
- 演算法 = 解決問題的方法
- 程式實作程序: 演算法 -> sudo code (算complexity) -> 程式語言(just查表、書)
- 不要為了學語言而學語言(C++, Java, Python...),要學習解決問題的方法
System life circle
例: 如何實作搜尋引擎System?
1. Requirement:
了解Input & Output 還有 所要達到的功能
- 網路爬蟲把所有網頁載下來
- 分析網頁建關鍵字、index
- query(詢問) result
使用者面向:
- query(詢問) word
- return web pages
2. Analysis:
- Bad / Bottom-up
- Nice / Top-down 巨觀看要做的是什麼System最後進入微觀
3. Design:
ADT (abstract data types) 抽象資料型別
為了擺脫和implement緊密連結,實現implementation-independent,簡單寫出他的concept,不要被執行的城市搞得太複雜
Algorithms
- Input
- Output
- 有限的步驟完成目的
4. Refinement & Coding:
5. Verification:
- testing正確性、有效性(100個搜索和1萬個搜索差別?) 可能memory爆掉
- 寫 Error-Code, Comment
6. 注意:
- Code readable?
- 有效運用storage
- Running time越小越好
其他
Unix 全用C寫出來的!
寫Android App / Java
寫IOS App / Object-C
大學 = 學習知識
研究所 = 創造知識